/*
 * ListenerJTreePersonal.java
 *
 * Created on 27 de diciembre de 2005, 17:08
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package fmap.gui.help;

import javax.swing.tree.TreePath;
import java.awt.event.MouseAdapter;

import fmap.DatosCompartidos;
import java.awt.Cursor;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;

/**
 *
 * @author javi
 */
public class ListenerJTree extends MouseAdapter implements TreeSelectionListener
{
    JFrameHelp jFrameHelp;
    
    /** Creates a new instance of ListenerDynamicTree */
    public ListenerJTree ( JFrameHelp _jFrameHelp )
    {
        jFrameHelp = _jFrameHelp;
    }
    
    
    public void valueChanged (TreeSelectionEvent e)
    {
        
        try
        {
            DatosCompartidos.getJFrameMain ().setCursor ( new Cursor (Cursor.WAIT_CURSOR) );

            TreePath nodoSeleccionado = e.getPath ();
            
            if( nodoSeleccionado != null )
            {
                NodeTree nodo = (NodeTree)nodoSeleccionado.getLastPathComponent ();
                
                
                jFrameHelp.getJSplitPane ().setRightComponent ( new SimpleHelp ("prueba", nodo.getPageHtml () ));

//    SimpleHelp simpleHelp = new SimpleHelp ("prueba","/home/javi/proyectos/xhtml/fmap/casos_uso2.html");


//                jFrameHelp.getSimpleHelp ().reloadPage (nodo.getPageHtml ());
            }

            DatosCompartidos.getJFrameMain ().setCursor ( new Cursor (Cursor.DEFAULT_CURSOR) );
        }
        catch(Exception ex)
        {
            System.out.println ("el error es "  + ex.toString ());
        }
        
        
    }
    
    
    
}
